# -*- mode: python -*-
###
#
# (c) 2000-2007 Wijnand Modderman <wijnand at tehmaze dot com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#   * Redistributions of source code must retain the above copyright notice,
#     this list of conditions, and the following disclaimer.
#   * Redistributions in binary form must reproduce the above copyright notice,
#     this list of conditions, and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#   * Neither the name of the author of this software nor the name of
#     contributors to this software may be used to endorse or promote products
#     derived from this software without specific prior written consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###

__revision__ = '$Hg: settings.py,v 9231c7107cb4 2007/01/03 15:44:33 +0100 $'

# system imports
import os
import sys

# Internals
DDB_VERSION  = '10.2.1-alpha'
DDB_CODENAME = 'CURRENT'
URL_SOURCE   = 'http://code.google.com/p/ddbbot/source'
URL_BUGS     = 'http://code.google.com/p/ddbbot/issues/list'
URL_REPO     = 'http://code.freecode.nl/ddb/'

# Logging/tmp
LOGDIR       = 'log/'
ERRORLOG     = LOGDIR + 'error.log'
DEBUGLOG     = LOGDIR + 'debug.log'
INFOLOG      = LOGDIR + 'ddb.log'
LOGSIZE      = 1024000
PIDFILE      = 'ddb.pid'

# Queue processing/polling
QUEUE_POLL              = 0.15      # Interval for output queue polling

# Lag checking
LAG_POLL                = 30        # Interval for lag checks

# Caching
CACHE_INVALIDATE        = 5         # Interval for expiration checks
CACHE_POSITIVE_LIFETIME = 300       # Positive cache time
CACHE_NEGATIVE_LIFETIME = 30        # Negative cache time

# Configs
CONFIG_AUTOSAVE         = 120       # Interval for save checker
CONFIG_BACKUP_SUFFIX    = '~'       # Suffix for backup files

# Database
DB_REENCODE_TO          = 'iso-8859-1'

# User flags and their meaning
USER_FLAG = {
    'a': 'auto-ops',
    'i': 'auto-ignore',
    'u': 'usermod',
    'o': '(channel) operator',
    'n': '(channel) owner'
    }

# IRC related
PREFIX_CHANNEL          = '#&!+'    # Channel prefixes
IDENT_PREFIX            = ['^', '~', '+', '-', 'n=', 'i=']
IRC_RECONNECT_SLEEP     = 15        # Interval after disconnect
IRC_FAILURE_SLEEP       = 120       # Interval after connection failure
IRC_NICKCHECK_SLEEP     = 120       # Interval to see if we have our desired nick
IRC_MAX_MSGLENGTH       = 420       # Max packet length
HOST_DOTS_MASK          = 3         # Mask hosts after this many dots
IRC_SPLIT_LINE          = '..'      # Character to split lines with

# HTTP related
HTTP_WAITFOROUTPUT      = 5         # Seconds to wait for output
HTTP_USERAGENT          = 'Mozilla/5.0 (compatible; DDB/%s; +http://www.dasbier.nl/)' % DDB_VERSION

# Charsets
reload(sys)
sys.setdefaultencoding('utf-8')

# Repository visioning
if os.path.isdir('.svn'):
    f        = open('.svn/entries')
    entries  = f.readlines()
    f.close()
    svn      = False
    revision = 0
    for line in entries:
        if 'committed-rev' in line:
            svn = True
            _, revision, _ = line.split('"', 2)
        break
    if svn:
        DDB_VERSION.replace('CURRENT', 'SVN r%s' % revision)
elif os.path.isdir('.hg'):
    DDB_VERSION.replace('CURRENT', 'HG')

# vim:ts=4:sw=4:et:
